import {TreeProps} from "antd";
import IconFont from "@/util/icon-config.tsx";

/**
 * 树图标转换器,将string类型的数图标,转换为树可以显示的ReactNode图标
 * @param treeData
 */
export const treeIconConvert =(treeData: TreeProps['treeData']) => {
    if (treeData === void 0){
        return;
    }
     treeData.forEach(node => {
        if (typeof node.icon === "string"){
            node.icon = <IconFont type={node.icon}/>
        }
        if (node.children){
            treeIconConvert(node.children)
        }
    })
}